#import <sys/types.h>
#import <sys/socket.h>
#import <netinet/in.h>

#import <GraphicsServices/GraphicsServices.h>
#import <UIKit/UIApplication.h>

#define DEFAULT_PANEL_PATH	@"/private/var/mobile/Library/TouchRemocon"

@class NSArray;

@class UIWindow, UITabBar, UITabBarItem, UITransitionView, UIScreen;

@class PreferencesView;
@class Panel, PadPanel, MediaPanel, TVPanel, NumericPanel, KeyboardPanel;

typedef enum
{
	TabItemPad = 0,
	TabItemMedia,
	TabItemTV,
	TabItemNumeric,
	TabItemKeyboard,
	TabItemPreferences,
	TabItemLast,
} TabItem;

@interface Application : UIApplication 
{
	NSUserDefaults *defaults;
	
	UIWindow *window;
	UIView *view;
	UITransitionView *content;
	UITabBar *tabBar;
	
	NSMutableArray *items;	// UITabBar.items
	
	// panel
	BOOL panelLocked;
	TabItem currentTab;
	PadPanel *padPanel;
	MediaPanel *mediaPanel;
	TVPanel *tvPanel;
	NumericPanel *numericPanel;
	KeyboardPanel *keyboardPanel;
	PreferencesView *prefs;
	
	// socket
	int sock;
	struct sockaddr_in addr;
}

+ (void)initialize;

- (void)dealloc;

- (void)applicationDidFinishLaunching:(UIApplication *)application;

- (void)qtKeyClicked:(int)key;
- (void)qtKeyPressed:(int)key;
- (void)qtKeyReleased:(int)key;

- (void)sendingTextRequested:(NSString *)text;

// navigation bar delegate
- (void)navigationBar: (UINavigationBar*)navigationBar buttonClicked: (int)button;

// status bar event
- (void)statusBarMouseDown: (GSEventRef)event;
- (void)statusBarMouseUp: (GSEventRef)event;
/*
- (void)statusBarMouseDragged: (GSEventRef)event;
*/
@end
